﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.Master" AutoEventWireup="true"
    CodeBehind="admin_workspic.aspx.cs" Inherits="Web.admin_workspic" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cssContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="jsContent" runat="server">

    <script type="text/javascript" language="javascript">
    function divupload() {
        divuploader = new qq.FileUploaderBasic({
            // pass the dom node (ex. $(selector)[0] for jQuery users)
            //element: document.getElementById('divajaxupload'),
            button: document.getElementById('btnajaxupload'),
            // path to server-side upload script
            action: 'admin_uploadimage.aspx?action=upload',
            allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
            sizeLimit: 1024000,
            multiple: false,
            debug: true,
            onSubmit: function(id, fileName) {

            },
            onComplete: function(id, fileName, responseJSON) {
                AddImage(id, fileName, responseJSON.filename);
            }
        });
    }
    $(function() {
        divupload();
    });
    function AddImage(id,fileName,fileUrl) {        
        var img = "<img src='" + fileUrl + "' />";
        var hidden = "<input type='hidden' name='picurl[]' value='" + fileUrl + "'/>";
        var op = "<a href='javascript:DeleteImage(" + id + ",0);return false;'>删除</a>";
        var headshow = "<input type='radio' name='headshow' value='" + fileUrl + "'/>";
        var level = "<input type='text' name='piclevel[]' value='"+(100-id)+"' />";
        var name = "<input type='text' name='picname[]' value='"+fileName+"' />";
        //var adiv = "<div class='file-row' id='file-0" + id + "'>" + item + level + name + "</div>";
        var atr = "<tr class='file-row' id='file-0" + id + "'>";
        atr += "<td>" + img +hidden+ "</td>";
        atr += "<td>" + headshow + "</td>";
        atr += "<td>" + level + "</td>";
        atr += "<td>" + name + "</td>";
        atr += "<td>" + op + "</td>";
        $("#file-list").append(atr);
    }
    function DeleteImage(id,type)
    {
        if (type == 0) {
            $("#file-0" + id).remove();
        } else if (type == 1) {
            $("#file-delete").append("<input type='hidden' name='delete[]' value='" + id + "'>");
            $("#file-" + id).remove();
        }
        return false;
    }
    </script>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="mainContent" runat="server">
    <div class="content-box">
        <!-- Start Content Box -->
        <div class="content-box-header">
            <h3>
                案例管理</h3>
            <ul class="content-box-tabs">
                <li><a href="admin_newscategory.aspx">列表</a></li>
                <li><a href="admin_ncadd.aspx" class="default-tab">添加</a></li>
            </ul>
            <div class="clear">
            </div>
        </div>
        <!-- End .content-box-header -->
        <div class="content-box-content">
            <div class="tab-content default-tab" id="tab1">
                <!-- This is the target div. id must match the href of this div's tab -->
                <asp:ScriptManager ID="ScriptManager1" runat="server">
                </asp:ScriptManager>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true">
                    <ContentTemplate>
                        <div class="notification error png_bg" id="noticefail" runat="server">
                            <a href="#" class="close">
                                <img src="resources/images/icons/cross_grey_small.png" title="Close this notification"
                                    alt="close" /></a>
                            <div>
                                添加失败！请检查各个字段是否正确！如果多次失败，请联系技术！谢谢！
                            </div>
                        </div>
                        <div id="noticesuccess" runat="server">
                            <div class="notification success png_bg">
                                <a href="#" class="close">
                                    <img src="resources/images/icons/cross_grey_small.png" title="Close this notification"
                                        alt="close" /></a>
                                <div>
                                    添加成功！<a href="admin_service.aspx">返回列表</a>&nbsp;&nbsp;<a href="admin_serviceadd.aspx">继续添加</a>
                                </div>
                            </div>
                        </div>
                        <fieldset>
                            <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
                            <p>
                                <label>
                                    案例标题</label>
                                <asp:TextBox ID="txbTitle" runat="server" CssClass="text-input medium-input"></asp:TextBox>
                                <span class="input-notification success png_bg" id="noticeNameSame" runat="server">
                                </span>
                            </p>
                            <p>
                                <label>
                                    案例类型</label>
                                <asp:DropDownList ID="ddlCategory" runat="server">
                                </asp:DropDownList>
                            </p>
                            <p class="column-left">
                                <label>
                                    是否置顶</label>
                                <asp:DropDownList ID="ddlTop" runat="server">
                                </asp:DropDownList>
                            </p>
                            <p class="column-right">
                                <label>
                                    是否热门</label>
                                <asp:CheckBox ID="chbHot" runat="server" />
                            </p>
                            <div class="clear">
                            </div>
                            <p class="column-left">
                                <label>
                                    客户名称</label>
                                <asp:TextBox ID="txbCustomerName" runat="server" CssClass="text-input medium-input"></asp:TextBox>
                            </p>
                            <p class="column-right">
                                <label>
                                    合作时间:</label>
                                <asp:TextBox ID="txbTeamWorkTime" runat="server" CssClass="text-input medium-input"></asp:TextBox>
                            </p>
                            <div class="clear">
                            </div>
                            <p>
                                <div class="" id="uploadimage2">
                                    请选择缩略图进行上传，大小为200x100，或者保持此比例！<br />
                                    <br />
                                    <div id="divajaxupload">
                                    </div>
                                    <div id="btnajaxupload" class="uploadbtnclass">
                                    上传
                                    </div>
                                    <%--<button id="btnajaxupload" value="upload">
                        upload</button>--%>
                                    <button id="btnDeleteOldImage" onclick="deletePreImage();" class="deletebtnclass">
                                        删除</button>
                                    <div id="file-upload-list">
                                        <table border="0">
                                            <thead>
                                                <tr>
                                                    <td>
                                                        图片预览
                                                    </td>
                                                    <td>
                                                        设为封面
                                                    </td>
                                                    <td>
                                                        图片排序(越大越靠前，可忽略)
                                                    </td>
                                                    <td>
                                                        图片提示(鼠标移上去的提示)
                                                    </td>
                                                    <td>
                                                        操作
                                                    </td>
                                                </tr>
                                            </thead>
                                            <tbody id="file-list">
                                                <asp:Repeater ID="WorksPicRpt" runat="server">
                                                    <ItemTemplate>
                                                        <tr>
                                                            <td>
                                                                <img src='<%#Eval("PicURL") %>' /><input type="hidden" name="picurl[]" value="<%#Eval("PicURL") %>">
                                                            </td>
                                                            <td>
                                                                <input type='radio' name='headshow' value='<%#Eval("PicID") %>' />
                                                            </td>
                                                            <td>
                                                                <input type="text" name="piclevel[]" value="<%#Eval("PicLevel") %>">
                                                            </td>
                                                            <td>
                                                                <input type="text" name="picname[]" value="<%#Eval("PicName") %>">
                                                            </td>
                                                            <td>
                                                                <a href="javascript:DeleteImage(<%#Eval("PicID") %>,1);return false;">删除</a>
                                                            </td>
                                                        </tr>
                                                    </ItemTemplate>
                                                </asp:Repeater>
                                            </tbody>
                                        </table>
                                        <div id="file-delete">
                                        </div>
                                    </div>
                                </div>
                            </p>
                            <p>
                                <label>
                                    案例内容</label>
                                <CKEditor:CKEditorControl ID="txbContent" runat="server" Columns="79" CssClass="text-input textarea"
                                    Rows="15" TextMode="MultiLine"></CKEditor:CKEditorControl>
                            </p>
                            <p>
                                <asp:Button ID="btnSubmit" runat="server" CssClass="button" OnClick="btnSubmit_OnClick"
                                    Text="提交" />
                                <input class="button" type="Reset" value="取消" />
                            </p>
                            <p>
                            </p>
                            </span>
                        </fieldset>
                        <div class="clear">
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <!-- End .clear -->
            </div>
            <!-- End #tab1 -->
        </div>
        <!-- End .content-box-content -->
    </div>
</asp:Content>
